blob: 6ae699d2b4cc993f7285178b77a9693a17826122 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
<script>
import { t } from '$lib/translations';
import { enhance } from '$app/forms';
import { Icon, Numpad, Spinner } from '$comp';
import { page } from '$app/stores';
import { back, s } from '$lib/utils';
import { pin } from '$lib/store';
export let data;
export let form;
let { payreq } = $page.params;
let { alias } = data;
let { currency } = data.user;
let amount = form?.amount || data.amount;
let a;
let maxfee = 100;
let loading;
let submit = () => (loading = true);
$: update(form);
let update = () => {
if (form?.message?.includes('pin')) $pin = undefined;
loading = false;
};
let show;
let toggle = () => (show = !show);
</script>
<button class="ml-5 md:ml-20 mt-5 md:mt-10 hover:opacity-80" on:click={back}>
<Icon icon="arrow-left" style="w-10" />
</button>
{#if form?.message}
<div class="text-red-600 text-center">
{form.message}
</div>
{/if}
<div class="container px-4 mt-20 max-w-xl mx-auto">
{#if amount}
<div class="text-center mb-8">
<h1 class="text-xl md:text-2xl text-secondary mb-2">{$t('payments.send')}</h1>
<p class="text-6xl break-words mb-4">
⚡️{s(amount)}
</p>
<h1 class="text-xl md:text-2xl text-secondary mb-2">{$t('payments.to')}</h1>
<p class="text-4xl break-words">{alias}</p>
</div>
<form method="POST" use:enhance on:submit={submit} action="?/send" class="space-y-5">
<input name="payreq" value={payreq} type="hidden" />
<input name="amount" value={amount} type="hidden" />
<input name="confirmed" value={form?.confirm} type="hidden" />
<input name="pin" value={$pin} type="hidden" />
<input name="maxfee" value={maxfee} type="hidden" />
<div class="flex w-full">
<button
type="submit"
class="opacity-100 hover:opacity-80'} rounded-2xl border py-3 font-bold mx-auto mt-2 bg-black text-white px-4 w-24"
disabled={loading}
>
{#if loading}
<Spinner />
{:else}
{$t('payments.send')}
{/if}
</button>
</div>
</form>
{#if show}
<div class="relative w-96 mx-auto">
<label for="maxfee">Max fee</label>
<input name="maxfee" value={maxfee} />
<div
class="absolute right-[2px] top-[25px] text-gray-600 rounded-r-2xl p-4 h-[54px] my-auto border-l "
>
⚡️
</div>
</div>
{:else}
<div class="flex w-full mt-5">
<button class="mx-auto" on:click={toggle}>Settings</button>
</div>
{/if}
{:else}
<form method="POST" action="?/setAmount" class="w-[300px] mx-auto">
<input type="hidden" value={a} name="amount" />
<Numpad bind:amount={a} {currency} />
<button
type="submit"
class="bg-black text-white rounded-xl h-[48px] flex w-full justify-center items-center font-semibold
opacity-100 hover:opacity-80"
>
Next
</button>
</form>
{/if}
</div>
|